<%@ page import="java.sql.*" %>
<% String id = request.getParameter("id");%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>条件查询</title>
    <%! ResultSet rs;%>
    <%
        String dbName = "jbdc";
        String userName = "root";
        String userPasswd = "123456";
        String url = "jdbc:mysql://localhost/"+"?user="+userName+"&password="+userPasswd;
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn= DriverManager.getConnection(url);
        Statement statement =conn.createStatement();
        String sql = "select*from student where id ="+id+"";
        rs=statement.executeQuery(sql);
    %>
</head>
<body>
<table border="1">
    <th colspan="4"style="font-size: x-large;alignment: center">学生信息</th>
    <tr style="text-align: center">
        <th>学号</th>
        <th>姓名</th>
        <th>出生日期</th>
        <th>所在班级</th>
    </tr>
    <%
        while (rs.next()){
    %>
    <tr style="text-align: center;">
        <td><%=rs.getString(1)%></td>
        <td><%=rs.getString(2)%></td>
        <td><%=rs.getString(3)%></td>
        <td><%=rs.getString(4)%></td>
    </tr>
    <%}%>
    <%
        rs.close();
        statement.close();
        conn.close();
    %>
</table>
</body>
</html>